import request from '@/utils/request'
import {HOST} from '@/constants'
import qs from 'qs'
import da from "element-ui/src/locale/lang/da";


export function userLogin(data) {
  return request({
    url: `${HOST}/login`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function queryOneAward(data) {
  return request({
    url: `${HOST}/queryOneAward/${data}`,
    method: 'get',
    //data: data
  })
}




export function teacherLogin(data) {
  return request({
    url: `${HOST}/login/teacher`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function studentLogin(data) {
  return request({
    url: `${HOST}/login/student`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function uploadMaterial(data) {
  return request({
    url: `${HOST}/teacher/material/add`,
    method: 'post',
    data
  })
}

export function getMaterialByType(data) {
  return request({
    url: `${HOST}/material/get`,
    method: 'get',
    params: data
  })
}

export function deleteMaterial(data) {
  return request({
    url: `${HOST}/teacher/material/delete`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function addLink(data) {
  return request({
    url: `${HOST}/teacher/link/add`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function deleteLink(data) {
  return request({
    url: `${HOST}/teacher/link/delete`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function getLink(data) {
  return request({
    url: `${HOST}/link/get`,
    method: 'get',
    params: data
  })
}

export function getHomeworkList(data) {
  return request({
    url: `${HOST}/homework/list/get`,
    method: 'get',
    params: data
  })
}

export function getOneHomework(data) {
  return request({
    url: `${HOST}/homework/one/get`,
    method: 'get',
    params: data
  })
}

export function updateOneHomework(data) {
  return request({
    url: `${HOST}/teacher/homework/one/update`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function addOneHomework(data) {
  return request({
    url: `${HOST}/teacher/homework/one/add`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function uploadHomeworkAttachFile(data) {
  return request({
    url: `${HOST}/teacher/homework/file/attach/add`,
    method: 'post',
    data
  })
}

export function getHomeworkAttachFileListByHid(data) {
  return request({
    url: `${HOST}/homework/file/attach/list/get`,
    method: 'get',
    params: data
  })
}

export function deleteOneHomeworkAttachfile(data) {
  return request({
    url: `${HOST}/teacher/homework/file/attach/delete`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function uploadHomeworkSubmitFile(data) {
  return request({
    url: `${HOST}/student/homework/file/submit/add`,
    method: 'post',
    data
  })
}

export function getSubmitListByStudent(data) {
  return request({
    url: `${HOST}/student/file/submit/get`,
    method: 'get',
    params: data
  })
}

export function getSubmitListByTeacher(data) {
  return request({
    url: `${HOST}/teacher/file/submit/get`,
    method: 'get',
    params: data
  })
}

export function deleteOneSubmit(data) {
  return request({
    url: `${HOST}/student/file/submit/delete`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function getNoticeListByClassid(data) {
  return request({
    url: `${HOST}/notice/list/get`,
    method: 'get',
    params: data
  })
}

export function addOneNotice(data) {
  return request({
    url: `${HOST}/teacher/notice/add`,
    method: 'post',
    data: qs.stringify(data)
  })
}

export function getOneNotice(data) {
  return request({
    url: `${HOST}/notice/one/get`,
    method: 'get',
    params: data
  })
}

export function updateOneNotice(data) {
  return request({
    url: `${HOST}/teacher/notice/one/update`,
    method: 'post',
    data: qs.stringify(data)
  })
}
